//
//  ViewController.m
//  test
//
//  Created by 程智龙 on 15/12/24.
//  Copyright © 2015年 码农君－lorne. All rights reserved.
//

#import "ViewController.h"
#import "CZLProgressView.h"
@interface ViewController ()
{
    CZLProgressView * _calprogress;
    UILabel * lab;
  
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _calprogress=[[CZLProgressView alloc]init];
    _calprogress.CZLprogress=0.43f;
    lab=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
    lab.backgroundColor=[UIColor clearColor];
    lab.font=[UIFont systemFontOfSize:30.0f];
    lab.textColor=[UIColor blackColor];
    [_calprogress addSubview:lab];
    lab.textAlignment=NSTextAlignmentCenter;
    lab.text=[NSString stringWithFormat:@"%d%s",(int)(_calprogress.CZLprogress*100),"%"];
    
   // [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(progressadd) userInfo:nil repeats:YES];
  
    [self.view addSubview:_calprogress];
    
   
     UISlider * slider=[[UISlider alloc]initWithFrame:CGRectMake(50, 300, 200, 100)];
    [slider addTarget:self action:@selector(log:) forControlEvents:UIControlEventValueChanged];
    
    [self.view addSubview:slider];
    
    
}
-(void)log:(UISlider *)slider1{

    _calprogress.CZLprogress=[slider1 value];
}
-(void)progressadd{
    
    if (_calprogress.CZLprogress>=1) {
        return;
    }
    _calprogress.CZLprogress+=0.01;
    
    lab.text=[NSString stringWithFormat:@"%d%s",(int)(_calprogress.CZLprogress*100),"%"];
   
    //
    //中间文字显示直接加个lab 控件多处复用的话 添加在CZLProgressView类中
    //

}

@end
